#pragma once
#include "defendermachine.h"

#define F_NOBLITTERXOR	4
#define F_NVRAM8BIT		8
#define F_MUXINPUT		0x10

class CWilliamsMachine:public CDefenderMachine
{
protected:
	u8 BlitterMask;
	u8 BlitterSrcHi,BlitterSrcLo;
	u8 BlitterDestHi,BlitterDestLo;
	u8 BlitterHeight,BlitterWidth;
	u8 ActivePort;
protected:
	__inline void blit_pixel(int offset, int srcdata, int data, int mask, int solid);
	__inline int blitter_core(int sstart, int dstart, int w, int h, int data);
	void ExecuteBlit(u8 data);
public:
	CWilliamsMachine();
	virtual ~CWilliamsMachine();
	virtual int Init();
	virtual void Reset();
	virtual void Line(u32 mainc,u32 soundc,int irq);
	virtual void SaveState(CState *s);
	virtual void LoadState(CState *s);
	static u8 ReadMainCPU(void *user,u32 addr);
	static void WriteMainCPU(void *user,u32 addr,u8 data);
	static u8 PIA0_InputA_Mux(void *user);
	static void PIA0_OutputCB2_Mux(void *user,u8 data);
};
